package org.benjamin.lending.domain.entity;

import java.math.BigDecimal;
import java.sql.Timestamp;

import javax.persistence.*;

import org.hibernate.annotations.CreationTimestamp;

@Entity
@Table(name = "tab_transact_request")
public class TransactRequest {

    @Id
    private String id;

    @ManyToOne
    @JoinColumn(name = "borrow_id")
    private BorrowInfo borrowInfo;

    @ManyToOne()
    @JoinColumn(name = "memberInfo_id",nullable = false)
    private MemberInfo memberInfo;

    @Column(name = "money")
    private BigDecimal money;

    @Enumerated(EnumType.STRING)
    @Column(name = "type",nullable = false)
    private Type type;

    @Column(name = "relation_id")
    private Integer relationId;

    @Column(name = "target_url")
    private String targetUrl;

    @Enumerated(EnumType.STRING)
    @Column(name = "status",nullable = false)
    private Status status;

    @Lob
    @Column(name = "orig_param")
    private String origParam;

    @Lob
    @Column(name = "pack_data", nullable = false)
    private String packData;

    @Lob
    @Column(name = "result_data")
    private String resultData;

    @Column(name = "create_time")
    @CreationTimestamp
    private Timestamp createTime;

    @Column(name = "processing_time")
    private Timestamp processingTime;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public BorrowInfo getBorrowInfo() {
        return borrowInfo;
    }

    public void setBorrowInfo(BorrowInfo borrowInfo) {
        this.borrowInfo = borrowInfo;
    }

    public MemberInfo getMemberInfo() {
        return memberInfo;
    }

    public void setMemberInfo(MemberInfo memberInfo) {
        this.memberInfo = memberInfo;
    }

    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    public Integer getRelationId() {
        return relationId;
    }

    public void setRelationId(Integer relationId) {
        this.relationId = relationId;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public String getTargetUrl() {
        return targetUrl;
    }

    public void setTargetUrl(String targetUrl) {
        this.targetUrl = targetUrl;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public String getOrigParam() {
        return origParam;
    }

    public void setOrigParam(String origParam) {
        this.origParam = origParam;
    }

    public String getPackData() {
        return packData;
    }

    public void setPackData(String packData) {
        this.packData = packData;
    }

    public String getResultData() {
        return resultData;
    }

    public void setResultData(String resultData) {
        this.resultData = resultData;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Timestamp getProcessingTime() {
        return processingTime;
    }

    public void setProcessingTime(Timestamp processingTime) {
        this.processingTime = processingTime;
    }

    /**
     * 
     * @author xywen
     *
     */
    public enum Type {
        TENDER, 
        RECHARGE,//dadsa
        WITHDRAW,REGISTER_USER,REAL_NAME
    }

    public enum Status{
        READY,SEND,PROCESS,COMPLETE,FAIL
    }

}
